<template>
  <aigc-dialog ref="aigcDialogInstance" width="500" title="修改账户名">
    <el-form>
      <el-form-item label="账户名">
        {{ user.account }}
      </el-form-item>
      <el-form-item label="新账户名">
        <el-input v-model="newAccount" ></el-input>
      </el-form-item>
      <!-- <el-form-item label="短信验证码"></el-form-item> -->
    </el-form>
    <template #dialogfooter>
      <el-button type="primary" @click="submitInfo">确定</el-button>
    </template>
  </aigc-dialog>
</template>
<script setup lang="ts">
import aigcDialog from "@/components/aigcDialog";
import { reactive, ref } from "vue";
import { useUserStore } from "@/store";
import { msgSuccess } from "@/utils";
const userStore = useUserStore();
const user = reactive(userStore.user)
const aigcDialogInstance = ref();
const newAccount = ref("")
const submitInfo=()=>{
  aigcDialogInstance.value.openDialog(false);
  userStore.user.account = newAccount.value
  msgSuccess("修改成功")
}
const openDialog = (isopen: boolean) => {
  aigcDialogInstance.value.openDialog(isopen);
};

defineExpose({
  openDialog,
});
</script>
<style lang="scss" scoped></style>
